package com.scau.meetingbook.mapper;

import com.scau.meetingbook.dto.CancellationRequestDTO;
import com.scau.meetingbook.pojo.CancellationRequests;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 取消预定申请表 Mapper 接口
 * </p>
 *
 * @author scau
 * @since 2025-06-07
 */
public interface CancellationRequestsMapper extends BaseMapper<CancellationRequests> {
    @Select("SELECT cr.request_id, cr.reservation_id, cr.user_id, " +
            "cr.request_time, cr.status, cr.refund_amount, " +
            "rr.room_id, mr.name AS room_name, " +
            "rr.reservation_date, rr.start_time, rr.end_time, " +
            "u.name AS user_name, u.company_name, u.phone_number " +
            "FROM cancellation_requests cr " +
            "JOIN room_reservations rr ON cr.reservation_id = rr.reservation_id " +
            "JOIN meeting_rooms mr ON rr.room_id = mr.room_id " +
            "JOIN users u ON cr.user_id = u.user_id")
    List<CancellationRequestDTO> selectCancellationRequestDTOs();
}
